/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.sigepa.recocidosimulado.Modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author carloslengua
 */
@Entity
@Table(name = "paquete_sim")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PaqueteSim.findAll", query = "SELECT p FROM PaqueteSim p"),
    @NamedQuery(name = "PaqueteSim.findByIdpaquete", query = "SELECT p FROM PaqueteSim p WHERE p.idpaquete = :idpaquete")})
public class PaqueteSim implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idpaquete")
    private Integer idpaquete;
    @JoinColumn(name = "idestado", referencedColumnName = "idestado")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private EstadoPaquete estadoPaquete;
    @JoinColumn(name = "idenvio", referencedColumnName = "idenvio")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Envio envio;

    public PaqueteSim() {
    }

    public PaqueteSim(Integer idpaquete) {
        this.idpaquete = idpaquete;
    }

    public Integer getIdpaquete() {
        return idpaquete;
    }

    public void setIdpaquete(Integer idpaquete) {
        this.idpaquete = idpaquete;
    }

    public EstadoPaquete getEstadoPaquete() {
        return estadoPaquete;
    }

    public void setEstadoPaquete(EstadoPaquete estadoPaquete) {
        this.estadoPaquete = estadoPaquete;
    }

    public Envio getEnvio() {
        return envio;
    }

    public void setEnvio(Envio envio) {
        this.envio = envio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpaquete != null ? idpaquete.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaqueteSim)) {
            return false;
        }
        PaqueteSim other = (PaqueteSim) object;
        if ((this.idpaquete == null && other.idpaquete != null) || (this.idpaquete != null && !this.idpaquete.equals(other.idpaquete))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.pucp.sigepa.recocidosimulado.Modelo.PaqueteSim[ idpaquete=" + idpaquete + " ]";
    }
    
}
